﻿using Cms.Core.Data.Audit;
using Cms.Core.Infrastructure.Extension;
using System;
using System.Collections.Generic;
using System.Text;

namespace Cms.Core.Data.Infrastructure
{
    public class EFEntityBase : EFEntityBase<Guid>
    {
        protected EFEntityBase()
        {
            if (Id == Guid.Empty)
            {
                Id = Guid.NewGuid();
            }
            if (ModifiedTime.HasValue)
            {

                ModifiedTime = DateTime.Now;
            }

        }
    }

    public class EFEntityBase<TPrimaryKey> : AuditEntryChek, IEFEntityBase<TPrimaryKey>
    {


        public virtual TPrimaryKey Id { get; set; }
        public virtual DateTime CreateTime { get; set; }
        public virtual Guid? CreateUserId { get; set; }
        public virtual Guid? ModifiedUserId { get; set; }
        public virtual bool IsDelete { get; set; }
        public virtual DateTime? ModifiedTime { get; set; }
    }
}
